<?php
$hostname_cpsms = "localhost:3306";
$database_cpsms = "cpsms";
$username_cpsms = "root";
$password_cpsms = "root"; 
$cpsms = mysql_connect($hostname_cpsms, $username_cpsms, $password_cpsms) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_create_db($database_cpsms); 

mysql_select_db('$database_cpsms',$cpsms); 
mysql_query("create table users
(
Archiveid int not null primary key auto_increment,
loginname varchar (40) unique not null,
loginpassword varchar (30) not null,
username varchar (30) not null,
PoliceIDNo int unique not null,
Gender int not null,
Birthplace varchar (30) not null,
DOB date not null,
Ethic varchar (10) not null,
Political varchar (10) not null,
PartyDate date,
WorkDate date,
PoliceWorkDate date,
photo blob,
CurrentPosition varchar (255),
Rank int not null,
FirstEducation varchar (255),
HighestEducation varchar (255),
HighestAcademicInstitution varchar (255)
)
;
create table superusers
(
sArchiveid int not null primary key auto_increment,
sloginname varchar (40) unique not null,
sloginpassword varchar (30) not null,
userid int not null
)
;
create table tempsuperusers
(
tsArchiveid int not null primary key auto_increment,
tsloginname varchar (40) unique not null,
tsloginpassword varchar (30) not null,
userid int not null
)
;

create table tempusers
(
tArchiveid int not null primary key auto_increment,
tloginname varchar (40) unique not null,
tloginpassword varchar (30) not null,
tusername varchar (30) not null,
tPoliceIDNo int unique not null,
tGender int not null,
tBirthplace varchar (30) not null,
tDOB date not null,
tEthic varchar (10) not null,
tPolitical varchar (10) not null,
tPartyDate date,
tWorkDate date,
tPoliceWorkDate date,
tphoto blob,
tCurrentPosition varchar (255),
tRank int not null,
tFirstEducation varchar (255),
tHighestEducation varchar (255),
tHighestAcademicInstitution varchar (255)
)
;

create table manager
(
mid int not null primary key auto_increment,
mloginname varchar (40) unique not null,
mloginpassword varchar (30) not null,
userid int
)
;

create table tempmanager
(
tmid int not null primary key auto_increment,
tmloginname varchar (40) unique not null,
tmloginpassword varchar (30) not null,
userid int
)
;

create table adminster
(
aid int not null primary key auto_increment,
aloginname varchar (40) unique not null,
aloginpassword varchar (30) not null,
aname varchar (40) not null,
aphone int(30) not null,
aemail varchar (40)
)
") or die(mysql_error()); 


?>